package com.ctrip.corp.obt.shard.aop.shard;


import com.ctrip.corp.obt.shard.handler.IShardingHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * @author marco.zheng
 * @version 1.0
 * @date 2022/02/09
 * @desc AbstractDataShardAspect
 * @see
 * @since 1.0
 */
@Slf4j
abstract class AbstractDataShardAspect {

    private final IShardingHandler shardingHandler;

    AbstractDataShardAspect(IShardingHandler shardingHandler) {
        this.shardingHandler = shardingHandler;
    }

    void preShard(String tableShardStrategy) {
        if (log.isDebugEnabled()) {
            log.debug("Choose tableShardStrategy:[{}]", tableShardStrategy);
        }
        // 判断是否开启了
        shardingHandler.preShard(tableShardStrategy);
    }

}
